<%--
  Created by IntelliJ IDEA.
  User: cjrh2
  Date: 2025/9/19
  Time: 19:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true" isELIgnored="false" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>

    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>


<table border="1" cellpadding="5" cellspacing="0" align="center">
    <tr>
        <th colspan="7">订单信息</th>
    </tr>

    <tr>
        <td align="center">id</td>
        <td align="center">name</td>
        <td align="center">ordertime</td>
        <td align="center">totalprice</td>
        <td align="center">status</td>
        <td colspan="2" align="center">action <a href="/mvc/add">新增</a></td>
    </tr>

    <c:forEach items="${orders}" var="o">
        <tr>
            <td>${o.id}</td>
            <td>${o.name}</td>
            <td>${o.ordertime}</td>
            <td>${o.totalprice}</td>
            <td>${o.status==1?"已支付":"未支付"}</td>
            <td><a href="/mvc/order/${o.id}" class="deleteBtn">删除</a></td>
            <td><a href="/mvc/toUpdate/${o.id}" class="updateBtn">修改</a></td>
        </tr>
    </c:forEach>
</table>

<form id="delete_form" method="post">
    <input type="hidden" name="_method" value="delete">
</form>


<script>

    /* $(".deleteBtn").on('click', function () {
         alert('123');
     })*/

    $(".deleteBtn").click(function () {
        // console.log(this);
        // alert('123');
        if (confirm('确认要删除吗')) {
            $("#delete_form").attr('action', this.href);
            $("#delete_form").submit();
        }
        return false;
    })

</script>

<%--<form action="/mvc/handle" method="get">
    <form action="/mvc/handle" method="post">
    <form action="/mvc/handle" method="put">
    <form action="/mvc/handle" method="delete">
    <input type="submit" value="get提交">
</form>--%>

<%--<hr>
<form action="/mvc/handleGet" method="get">
    <input type="submit" value="get提交">
</form>

<hr>
<form action="/mvc/handlePost" method="post">
    <input type="submit" value="post提交">
</form>

<hr>
<form action="/mvc/handlePut" method="post">
    <input type="hidden" name="_method" value="put">
    <input type="submit" value="put提交">
</form>

<hr>
<form action="/mvc/handleDelete" method="post">
    <input type="hidden" name="_method" value="delete">
    <input type="submit" value="delete提交">
</form>--%>
<%--
<hr>
<form action="/mvc/handle4" method="put">
    <input type="submit" value="put提交">
</form>
<hr>
<form action="/mvc/handle5" method="delete">
    <input type="submit" value="delete提交">
</form>--%>

</body>
</html>
